#include "transmit.h"

Transmit::Transmit(SerialPortInterface::SerialPort *serialport, QObject *parent) :
    QObject(parent)
{
    this->serialport = serialport;
    bytetype = character;
}

void Transmit::Send()
{
    if (bytetype == character)
        serialport->sendString(buf.toStdString());
    else
        serialport->sendChar(buf.toInt() & 0xFF);

    this->BufferSended(buf);
}

void Transmit::updateBuffer(QString string)
{
    buf = string;
}

void Transmit::ByteTypecharacter()
{
    bytetype = character;
}

void Transmit::ByteTypeinteger()
{
    bytetype = integer;
}
